package com.sky.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.DbIgnore;
import com.ejlchina.searcher.bean.SearchBean;
import com.sky.common.Attachment;
import com.sky.domain.BaseEntity;
import com.sky.entity.DishFlavor;
import lombok.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
@SearchBean(tables = "dish d " +
        " LEFT JOIN category c ON d.category_id = c.id and c.del_flag = '0' ",
        where = "d.del_flag = '0'", autoMapTo = "d")
public class DishVO extends BaseEntity {

    @DbField("d.id")
    private Long id;

    //菜品名称
    @DbField("d.name")
    private String name;

    //菜品分类id
    @DbField("d.category_id")
    private Long categoryId;

    //菜品价格
    @DbField("d.price")
    private BigDecimal price;

    //图片
    @DbField("d.image")
    private String image;

    //图片路径
    @DbField("d.cover")
    private String cover;

    //描述信息
    @DbField("d.description")
    private String description;

    //0起售  1 停售
    @DbField("d.status")
    private Integer status;

    //分类名称
    @DbField("c.name")
    private String categoryName;


    //菜品关联的口味
    @DbIgnore
    @TableField(exist = false)
    private List<DishFlavor> flavors = new ArrayList<>();

    /**
     *  封面图信息
     */
    @DbIgnore
    @TableField(exist = false)
    private Attachment attachment;
}
